{include file="public/headerbase" /}
{include file="public/left" /}
<div class="right-content">
<ul class="we7-page-tab">
	<li class="active"><a href="{:url('Coupon/index')}">优惠券</a></li>
</ul>
<div class="clearfix">
	<table class="table we7-table table-hover">
		<col width="150px"/>
		<col width="150px"/>
		<col width="150px"/>
		<col width="150px"/>
		<tr>
			<th>排序</th>
			<th>优惠券图片</th>
			<th>优惠金额</th>
			<th>操作</th>
		</tr>
		{foreach name="coupon" item="val"}
		<tr>
			<th><span>{$val.cid}</span></th>
			<th><span><img src="/uploads/{$val.cimg}" alt="" style="width:100px;"/></span></th>
			<th><span>{$val.cmoney}</span></th>
			<th>
				<span class="link-group">
					<a href="{:url('Coupon/update')}?cid={$val.cid}">编辑</a>
					<a href="javascript:;" class="del" onclick="del(this,{$val.cid})">删除</a>
				</span>
			</th>
		</tr>
		{/foreach}
			</table>
	<div class="pull-right">
			</div>
</div>
			</div>
		</div>
	</div>
</div>
</div>
<script type="text/javascript">
	function del(obj,cid){
		if(!confirm('确定删除吗')){
			return false;
		}
		$.ajax({
	        url: "{:url('Coupon/del')}",
	        data:{'cid':cid},
	        type: "post",
	        dataType: "json",
	        success: function (mega) {
	          if(mega==1){
	           		obj.parentNode.parentNode.parentNode.remove();
	           }else{
	           		util.message('删除失败', '', '');
	           }
	        }
    	});
	}
</script>
{include file="public/footer" /}